package com.book.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.book.common.annotation.group.InsertGroup;
import com.book.common.annotation.group.UpdateGroup;
import com.book.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @author Bigboss
 * @create 2024-10-19 20:44
 */
@ApiModel("图书")
@TableName("book")
public class Book extends BaseEntity {

    /**
     * 主键id
     */
    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotBlank(message = "请选择要修改的记录",groups = {UpdateGroup.class})
    private String id;


    /**
     * 书名
     */
    @ApiModelProperty("书名")
    @NotBlank(message = "请输入书名",groups = {InsertGroup.class, UpdateGroup.class})
    private String bookName;


    /**
     * 封面
     */
    @ApiModelProperty("封面")
    private String bookCover;


    /**
     * 作者
     */
    @ApiModelProperty("作者")
    @NotBlank(message = "请输入作者",groups = {InsertGroup.class, UpdateGroup.class})
    private String author;


    /**
     * 描述
     */
    @ApiModelProperty("描述")
    @TableField("`desc`")
    private String desc;


    /**
     * 分类id
     */
    @ApiModelProperty("书籍分类")
    @NotBlank(message = "请选择书籍分类",groups = {InsertGroup.class, UpdateGroup.class})
    private String categoryId;


    /**
     * ‘1’连载中 '2'已完结
     */
    @ApiModelProperty("书籍状态‘1’连载中 '2'已完结")
    private String status;

    /**
     * 目前加载的章节数
     */
    @ApiModelProperty("目前加载的章节数")
    private Integer chapter;

    /**
     * 更新完结时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;


    /**
     * 是否热门推荐
     */
    @ApiModelProperty("是否热门推荐")
    private String isPopular;

    /**
     * 对应的分类的id
     */
    @TableField(exist = false)
    private BookCategory category;

    /**
     * 是否添加到书架
     */
    @TableField(exist = false)
    @ApiModelProperty("是否添加到书架")
    private boolean isAddToShelf;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getBookCover() {
        return bookCover;
    }

    public void setBookCover(String bookCover) {
        this.bookCover = bookCover;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getChapter() {
        return chapter;
    }

    public void setChapter(Integer chapter) {
        this.chapter = chapter;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public BookCategory getCategory() {
        return category;
    }

    public void setCategory(BookCategory category) {
        this.category = category;
    }

    public boolean isAddToShelf() {
        return isAddToShelf;
    }

    public void setAddToShelf(boolean addToShelf) {
        isAddToShelf = addToShelf;
    }

    public String getIsPopular() {
        return isPopular;
    }

    public void setIsPopular(String isPopular) {
        this.isPopular = isPopular;
    }

    @Override
    public String toString() {
        return "Book{" +
                "id='" + id + '\'' +
                ", bookName='" + bookName + '\'' +
                ", bookCover='" + bookCover + '\'' +
                ", author='" + author + '\'' +
                ", desc='" + desc + '\'' +
                ", categoryId='" + categoryId + '\'' +
                ", status='" + status + '\'' +
                ", chapter=" + chapter +
                ", endTime=" + endTime +
                ", isPopular='" + isPopular + '\'' +
                ", category=" + category +
                ", isAddToShelf=" + isAddToShelf +
                '}';
    }
}
